#ifndef __DICTIONARY_HH__
#define __DICTIONARY_HH__

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>

using std::cout;
using std::string;
using std::vector;
using std::map;
using std::pair;
using std::set;

class Dictionary
{
public:
    static Dictionary* createInstance();
    static void destoryDict();

    void init(const string& dictpath);
    vector<pair<string, size_t>>& getDict();
    map<string, set<size_t>>& getIndexTable();
    void initIndexTable(const string& indexpath);
    set<int> doQuery(const string& word);

private:
    Dictionary();
    ~Dictionary(){};
private:
    vector<pair<string, size_t>> _dict;
    map<string, set<size_t>> _indexTable;
    static Dictionary* _instance;
};


#endif